<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>弹出框&警告框</title>
    <link href="bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="jquery-3.2.1.js"></script>
    <script src="bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
</head>
<body>
    <div class="container" style="padding: 100px 50px 10px;">
        <button type="button" class="btn btn-primary" title="popover title" data-container="body" data-toggle="popover" data-placement="left" data-content="左侧的Popover中的一些内容">左侧popover</button>
        <button type="button" class="btn btn-info" title="popover title" data-container="body" data-toggle="popover" data-placement="right" data-content="右侧的Popover中的一些内容">右侧popover</button>
        <button type="button" class="btn btn-warning" title="popover title" data-container="body" data-toggle="popover" data-placement="top" data-content="上方的Popover中的一些内容">上方popover</button>
        <button type="button" class="btn btn-danger" title="popover title" data-container="body" data-toggle="popover" data-placement="bottom" data-content="底部的Popover中的一些内容">底部popover</button>

        <br>

        <div class="alert alert-warning">
            <a href="#" class="close" data-dismiss="alert">&times;</a>
            <strong>警告!</strong>您的网络链接有问题.
        </div>

        <div class="alert alert-success" id="myAlert">
            <a href="#" class="close" data-dismiss="alert">&times;</a>
            <strong>成功!</strong>结果是成功的。
        </div>
    </div>

<script>
    $(function () {
        $("[data-toggle='popover']").popover();
    });
    $(function () {
        $(".btn-primary").popover("show");
    })
    $(function () {
        $(".btn-primary").on("hidden.bs.popover",function () {
            alert("那个谁,隐藏了");
        })
    })
    $(function () {
        $(".close").click(function () {
            $("#myAlert").alert("close");
        });
    })
    $(function () {
       $("#myAlert").bind("closed.bs.alert",function () {
           alert("警告消息框被关闭");
       })
    });
</script>
</body>
</html>